package com.guaoran.interview.in2018.basictypes.atomic;

import java.util.concurrent.atomic.AtomicBoolean;

/**
 * @Author gucheng
 * @Description
 *  AtomicBoolean
 * 2019-04-02 9:08
 */
public class AtomicBooleanDemo {
    public static void main(String[] args) {
        AtomicBoolean atomicBoolean = new AtomicBoolean();
//        System.out.println(atomicBoolean.get());
        atomicBoolean.set(true);
//        System.out.println(atomicBoolean.get());
//        System.out.println("++++++++++++++++++++++++++");
//        System.out.println(atomicBoolean.compareAndSet(atomicBoolean.get(), false));
//        System.out.println(atomicBoolean.get());
//        System.out.println("++++++++++++++++++++++++++");
//
//
//
//
        atomicBoolean.lazySet(false);
        atomicBoolean.lazySet(true);
//        System.out.println(atomicBoolean.get());
//
//        System.out.println(atomicBoolean.get());
//
//
//        System.out.println("++++++++++++++++++++++++++");

        System.out.println(atomicBoolean.getAndSet(false));

    }
}
